<template>
    <div class="detail">
        <van-loading size="24px" style="text-align: center" v-if="loading">加载中...</van-loading>
        <div v-else>
            <div class="title">{{detail.title}}</div>
            <div class="date">
                <van-icon name="clock-o" size="12px" color="#929292"/>
                <span>{{detail.created_at}}</span>
            </div>
            <div class="content" v-html="detail.content"></div>
        </div>
    </div>
</template>

<script>
    import {NewDetail} from '@/http/common'

    export default {
        name: "infodetail",
        data() {
            return {
                detail: {},
                id: '',
                loading: true
            }
        },
        created() {
            this.id = this.$route.query.id;
            this.id && this._NewDetail()
        },
        methods: {
            _NewDetail() {
                NewDetail(this.id).then(res => {
                    this.loading = false;
                    if (res.status == 1) {
                        this.detail = res.data;
                    }
                })
            }
        }
    }
</script>

<style scoped lang="scss">
    .detail {
        padding: 40px;

        .title {
            color: $fzColor;
            font-size: 34px;
            font-weight: bold;
            position: relative;
            line-height: 42px;

            &:after {
                content: '';
                width: 9px;
                height: 32px;
                background: rgba(205, 43, 50, 1);
                position: absolute;
                left: -17px;
                top: 0;
            }
        }

        .date {
            display: flex;
            align-items: center;
            justify-content: flex-end;
            color: #929292;
            font-size: 20px;
            padding: 5px 0;

            /deep/ .van-icon {
                margin-right: 10px;
            }
        }

        .content {
            padding: 30px 0;
            line-height: 36px;

            /deep/ img {
                max-width: 100% !important;
            }

            /deep/ video {
                max-width: 100% !important;
            }
        }
    }
</style>